package com.example.zuoye.controller;

import com.example.zuoye.entity.Good;
import com.example.zuoye.resultentity.ResultDT;
import com.example.zuoye.service.PublishedGoodService;
import com.example.zuoye.utils.ResultDTUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class PublishedGood {

    @Autowired
    PublishedGoodService publishedGoodService;

    /**
     * 返回发布的商品
     * @param userId
     * @return
     */
    @RequestMapping("/publishedGood")
    public ResultDT publishedGood(@RequestParam(value = "userId") String userId){
        List<Good> publishedGood = publishedGoodService.getListPublishedGood(userId);
        return ResultDTUtils.success(publishedGood);
    }

}
